const fs = require('fs')

let versionInfos = '/* Version Infos */\n'
let packageList = ['element-ui', 'element-theme','element-theme-chalk']

packageList.forEach(function (packageName) {
  try {
    let packageConfig = require(packageName + '/package.json')
    versionInfos += `/* ${packageName} : ${packageConfig.version}*/\n`
  } catch (error) {
    console.error(error)
  }
})

console.log(versionInfos)

fs.appendFileSync('build_theme/element-variables.scss', versionInfos ,{encoding:'utf-8'})
